package com.cmc.cloud.cmclink.doc.api.document;

import com.cmc.cloud.cmclink.doc.api.document.rep.manifestrep.manifest.*;
import com.cmc.cloud.cmclink.doc.api.document.req.SoManifestReqDto;
import com.cmc.cloud.cmclink.doc.constant.DocApiConstants;
import com.cmes.framework.common.pojo.CommonResult;
import com.cmes.framework.common.pojo.PageResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * 舱单
 *
 * @author wdq
 */
@FeignClient(name = DocApiConstants.NAME)
@Tag(name = "RPC - 服务 舱单")
@Valid
public interface ManifestApi {

    String PREFIX = DocApiConstants.PREFIX + "/manifest";

    /**
     * 获取未创建舱单的订舱信息
     *
     * @param csmCode
     * @return
     */
    @Operation(summary = "获取未创建舱单的订舱信息")
    @GetMapping(PREFIX + "/queryNotCreateSo/{csmCode}")
    CommonResult<List<SoManifestReqDto>> queryNotCreateSo(@PathVariable("csmCode") String csmCode);

    /**
     *
     * 批量删除未确认舱单
     *
     * @param ids ids
     * @param creator creator
     * @return
     */
    @Operation(summary = "批量删除未确认舱单")
    @PostMapping(PREFIX + "/batchDelete")
    CommonResult<Void> batchDelete(@RequestBody List<Long> ids, @RequestParam(name = "creator") String creator);

    /**
     * 创建更新主舱单
     *
     * @param createReqVO
     * @return
     */
    @Operation(summary = "创建更新主舱单")
    @PostMapping(PREFIX + "/createOrUpdateMasterAll")
    CommonResult<Long> createOrUpdateMasterAll(@Valid @RequestBody ManifestAllLsbCreateReqVO createReqVO);

    /**
     * 创建更新次舱单
     *
     * @param createReqVO
     * @return
     */
    @Operation(summary = "创建更新次舱单")
    @PostMapping(PREFIX + "/createOrUpdateSlaveAll")
    CommonResult<Long> createOrUpdateSlaveAll(@Valid @RequestBody ManifestAllLsbCreateReqVO createReqVO);

    /**
     * 根据订舱号获取舱单详情列表
     * @param createReqVO
     * @return
     */
    @Operation(summary = "根据订舱号获取舱单详情列表")
    @PostMapping(PREFIX + "/getDetailByBookingNo")
    CommonResult<List<ManifestInfoLbsRespVO>> getDetailByBookNo(@Valid @RequestBody ManifestQueryReqVO createReqVO);

    /**
     * 获得舱单分页
     *
     * @param pageVO
     * @return
     */
    @Operation(summary = "获得舱单分页")
    @PostMapping(PREFIX + "/getManifestPage")
    CommonResult<PageResult<ManifestIbsRespVO>> getManifestPage(@Valid @RequestBody ManifestPageReqVO pageVO);

    /**
     * 批量取消舱单
     * @param ids
     * @param creator
     * @return
     */
    @Operation(summary = "批量取消舱单")
    @PostMapping(PREFIX + "/cancelConfirmBatch")
    CommonResult<Void> cancelConfirm(@RequestBody List<Long> ids, @RequestParam(name = "creator") String creator);
}
